package SingletonInstance;
//单例模式:饿汉模式
class Singleton {
    private static Singleton instance = new Singleton();
    public static Singleton getInstance() {
        return instance;
    }
    private Singleton() {

    }
}

public class Demo {
    public static void main(String[] args) {
        //Singleton singleton = new Singleton();
        //fail：无法访问private构造1方法
    }
}
